<template>
	<z-paging ref="paging" v-model="dataList" @query="queryList"
		:loading-more-custom-style="{ paddingBottom: 'env(safe-area-inset-bottom)' }">
		<template #top>
			<nav-bar :title="title + '记录'" :iconLeft="true" />
		</template>
		<uni-card v-for="item in dataList" :key="item.id" margin="5px" spacing="0" :title="item.s_name"
			:sub-title="item.s_specification">
			<view class="swipe-action">
				<view>仓库名称：{{ item.warehouse_name }}</view>
				<view class="ctent">类型：{{ item.classify_display }}</view>
				<view class="ctent">上期剩余库存：{{ item.up_num_info }}</view>
				<view class="con">
					<view class="ctent" style="flex: none;">当前操作库存：</view>
					<view class="con" style="gap: 10rpx;">
						<up-icon :name="item.change_type == 1 ? 'plus' : 'minus'" :color="item.change_type == 1 ? 'green' : 'red'"
							size="16" />
						<view class="ctent">{{ item.up_num_info }}</view>
					</view>
				</view>
				<view class="ctent">剩余库存：{{ item.all_num_info }}</view>
				<view class="ctent">操作时间：{{ item.create_date }}</view>
				<view class="ctent">备注：{{ item.desc }}</view>
			</view>
		</uni-card>
	</z-paging>
</template>
<script setup>
import { ref, reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import wareInventoryApi from '../../../api/warehouse/ware_inventory'
const view_id = ref(null)
const title = ref('')
onLoad(option => {
	view_id.value = option.id
})
//数据请求

const paging = ref(null)
const dataList = ref([])
function queryList(pageNo, pageSize) {
	const params = {
		page: pageNo,
		page_size: pageSize,
		stock_control__id: view_id.value
	}
	wareInventoryApi.get_stock_control_change(params).then((res) => {
		title.value = res.results[0].s_name
		paging.value.complete(res.results);
	})
}

</script>

<style lang="scss"></style>